#python
#-*- coding: utf-8 -*-

import asyncio
from openai import AsyncOpenAI

async_client = AsyncOpenAI(base_url="http://localhost:11434/v1", api_key="ollama")

async def get_response(prompt, model="deepseek-r1:1.5b"):
    response = await async_client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": prompt}]
    )
    return response.choices[0].message.content

async def main():
    tasks = [get_response("你好！") for _ in range(5)]
    results = await asyncio.gather(*tasks)
    for result in results:
        print(result)


if __name__ == '__main__':
    asyncio.run(main())
